package com.jorado.etl.service.evaluate;

import com.jorado.core.utility.StringUtils;

public class DataModel {

    private String jobId;
    private String jobType;
    private String jobCityId;
    private String userId;
    private String sex = "1";
    private String cityId;
    private String schoolId;
    private String subMajorId;
    private Long dateTime;
    private String delimiter = ",";

    public DataModel() {
    }

    public DataModel(String line) {
        String[] items = line.split(delimiter);
        this.jobId = items[7];
        this.jobType = items[2];
        this.userId = items[0];
        this.cityId = items[3];
        this.jobCityId = items[5];
        this.sex = items[1];
        this.schoolId = items[4];
        this.subMajorId = items[6];
    }

    public UserInfo getUserInfo() {
        return new UserInfo(userId, sex, cityId, schoolId, subMajorId);
    }

    public JobInfo getJobInfo() {
        return new JobInfo(jobId, jobType, jobCityId);
    }

    public String getJobId() {
        if (StringUtils.isBlank(jobId))
            jobId = "0";
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getJobType() {
        if (StringUtils.isBlank(jobId))
            jobType = "0";
        return jobType;
    }

    public void setJobType(String jobType) {
        this.jobType = jobType;
    }

    public String getJobCityId() {
        if (StringUtils.isBlank(jobCityId))
            jobCityId = "0";
        return jobCityId;
    }

    public void setJobCityId(String jobCityId) {
        this.jobCityId = jobCityId;
    }

    public String getUserId() {
        if (StringUtils.isBlank(userId))
            userId = "0";
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getSex() {
        if (StringUtils.isBlank(sex))
            sex = "0";
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getCityId() {
        if (StringUtils.isBlank(cityId))
            cityId = "0";
        return cityId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public String getSchoolId() {
        if (StringUtils.isBlank(schoolId))
            schoolId = "0";
        return schoolId;
    }

    public void setSchoolId(String schoolId) {
        this.schoolId = schoolId;
    }

    public String getSubMajorId() {
        if (StringUtils.isBlank(subMajorId))
            subMajorId = "0";
        return subMajorId;
    }

    public void setSubMajorId(String subMajorId) {
        this.subMajorId = subMajorId;
    }

    public Long getDateTime() {
        return dateTime;
    }

    public void setDateTime(Long dateTime) {
        this.dateTime = dateTime;
    }

    public String getDelimiter() {
        return delimiter;
    }

    public void setDelimiter(String delimiter) {
        this.delimiter = delimiter;
    }

    @Override
    public String toString() {
        return getJobId() + delimiter + getJobType() + delimiter + getJobCityId() + delimiter + getUserId() + delimiter + getSex() + delimiter + getCityId() + delimiter + getSchoolId() + delimiter + getSubMajorId();
    }
}